export default {
  namespaced: true,
  state() {
    return {
      count: 1,
      massage: '公共数据',
      flag: true
    }
  },
  getters: {
    getmsg(state) {
      return state.count * 2
    }
  },
  actions: {
    asyncmsg(context) {
      setTimeout(() => {
        context.commit('increment')
      }, 1000)
    }
  },
  mutations: {
    increment(state) {
      state.count++
    },
    mass(state) {
      if (state.flag) {
        ;(state.massage = '已经修改'), (state.flag = !state.flag)
      } else {
        ;(state.massage = '公共数据'), (state.flag = !state.flag)
      }
    }
  }
}
